﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<% Option Explicit %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<META NAME="copyright" CONTENT="Copyright 2009-2010 - Martechina Co.Ltd" />
<META NAME="Author" CONTENT="劢格机械(中国)  Www.Martechina.Com" />
<META NAME="Keywords" CONTENT="" />
<META NAME="Description" CONTENT="" />
<TITLE>编辑企业</TITLE>
<link href="css.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../inc/Admin.js"></script>
</HEAD>
<!--#include file="../inc/Const.asp" -->
<!--#include file="../inc/ConnSiteData.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'cookie 验证
'if Instr(request.cookies("Martech_com")("AdminPurview"),"|15,")=0 then 
'  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
'  response.end
'end if

'session 验证
if Instr(session("AdminPurview"),"|15,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
  response.end
end if
'========判断是否具有管理权限
%>
<BODY>
<% 
dim Result
Result=request.QueryString("Result")
dim ID,Name,ViewFlag,Content,Key,miaoshu
dim GroupID,GroupIdName,Exclusive,ChildFlag
ID=request.QueryString("ID")
call AboutEdit() 
%>
<table border="0" cellspacing="1" cellpadding="0" height="0" align="center" width="100%" >
  <tr>
  <td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#ffffff">
  <tr>
    <td height="24" align="center" nowrap  class=classtop><a href="AboutEdit.asp?Result=Add" onClick='changeAdminFlag("添加企业信息")'>添加企业信息</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="AboutList.asp" onClick='changeAdminFlag("企业信息")'>查看企业信息</a></td>    
  </tr>
</table>
<br>
  <form name="editAboutForm" method="post" action="AboutEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
<tr>
 <td height="27" colspan="4" align="center" class="classtop"><strong>修改企业信息</strong></td>
</tr>
      <tr class=classtd>
        <td height="20" align="right" >信息名称：</td>
        <td ><input name="Name" type="text" class="textfield" id="Name" style="WIDTH: 240;" value="<%=Name%>" maxlength="100">&nbsp;发布：<input name="ViewFlag" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" checked <%if ViewFlag then response.write ("checked")%>>
&nbsp;*&nbsp;不少于1个字符</td>
      </tr>
        <tr class=classtd>
        <td height="20" align="right" >关键字：</td>
        <td ><input name="Key" type="text" class="textfield" id="Key" style="WIDTH: 240;" value="<%=Key%>" maxlength="100">
          &nbsp;发布：
&nbsp;&nbsp;6个词以内用<b>，</b>号隔开</td>
      </tr>
            <tr class=classtd>
        <td height="20" align="right" >描　　述：</td>
      <td  ><textarea name="miaoshu" rows="3" class="textfield" id="miaoshu" style="WIDTH: 440;"><%=miaoshu%></textarea>&nbsp;发布：&nbsp;&nbsp;250个字符以内</td> 
      </tr>         

     <tr class=classtd>
        <td height="20" align="right" valign="top">信息内容：<br>
      <td > <textarea name="content" style="display:none"><%=Server.HtmlEncode(Content)%></textarea>
          <!--<IFRAME ID="eWebEditor1" src="/martech_editor/ewebeditor.asp?id=content&style=s_light" frameborder="0" scrolling="no" width="650" height="350"></IFRAME>-->
          <IFRAME ID="eWebEditor1" SRC="../martech_editor/ewebeditor.htm?id=content&style=light" FRAMEBORDER="0" SCROLLING="no" WIDTH="650" HEIGHT="350"></IFRAME>
</td>
      </tr>
     <tr class=classtd>
        <td height="30" align="right">&nbsp;</td>
        <td valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
      </tr>
    </table>
  </form>
</td>
</tr>
</table>
</BODY>
</HTML>
<%
sub AboutEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then '保存编辑管理员信息
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("Name")))<1 then
      response.write ("<script language=javascript> alert('信息名称为必填项目！');history.back(-1);</script>")
      response.end
    end if
    if Result="Add" then '创建网站管理员
	  sql="select * from Martech_About"
      rs.open sql,conn,1,3
      rs.addnew
      rs("Name")=trim(Request.Form("Name"))
	  if trim(Request.Form("Key"))=""then 
	  rs("Key")=left(trim(Request.Form("Name")),6)
	  else
	  rs("Key")=trim(Request.Form("Key"))
	  end if
	  if trim(Request.Form("Miaoshu"))="" then
	  rs("Miaoshu")=left(trim(Request.Form("Content")),255)
	  else
	  rs("Miaoshu")=trim(Request.Form("Miaoshu"))
	  end if
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  rs("Content")=rtrim(Request.Form("Content"))
	    rs("Sequence")=99
	  rs("AddTime")=now()
	  rs("UpdateTime")=now()
	end if  
	if Result="Modify" then '修改网站管理员
      sql="select * from Martech_About where ID="&ID
      rs.open sql,conn,1,3
      rs("Name")=trim(Request.Form("Name"))
	  rs("Key")=trim(Request.Form("Key"))
	  rs("Miaoshu")=trim(Request.Form("Miaoshu"))
	  if Request.Form("ViewFlag")=1 then
        rs("ViewFlag")=Request.Form("ViewFlag")
	  else
        rs("ViewFlag")=0
	  end if
	  rs("Content")=Request.Form("Content")
 
	
	  rs("UpdateTime")=now()
	end if
	rs.update
	rs.close
    set rs=nothing 
    response.write "<script language=javascript> alert('成功编辑企业信息！');changeAdminFlag('企业信息列表');location.replace('AboutList.asp');</script>"
  else '提取管理员信息
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from Martech_About where ID="& ID
      rs.open sql,conn,1,1
	  Name=rs("Name")
	  Key=rs("Key")
	  Miaoshu=rs("Miaoshu")
	  ViewFlag=rs("ViewFlag")
	
      Content=rs("Content")

	  rs.close
      set rs=nothing 
	end if
  end if
end sub
%>

